package com.p2p.front.service.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.p2p.base.util.mail.SendCloudMail;
import com.p2p.front.service.SendInfoService;

@Service
public class SendInfoServiceImpl implements SendInfoService {

	private static final Logger logger = LoggerFactory.getLogger(SendInfoServiceImpl.class);
	
	@Override
	@Deprecated
	public boolean sendTextMessage(String mobileNum, String content,int sendTextMessageType) {
		if(logger.isDebugEnabled()) {
			logger.debug("向  " + mobileNum + "发送验证码 "+ content);
		}
		return true;
	}

	@Override
	public boolean sendEmail(String emailAddres, String targetUrl,int sendTextMessageType) {
		logger.info("向 " + "emailAddres" + "发送链接串是 ：" + targetUrl);
	/*	EmailSender emailSender = new EmailSender(true);
		try {
			emailSender.sendEmail(Arrays.asList(emailAddres), "邮箱认证", "请点击以下链接："+targetUrl);
		} catch (EmailException e) {
			e.printStackTrace();
		}*/
		SendCloudMail.send(emailAddres, "邮箱认证", "亲爱的用户：我们已接收到您请求开通认证邮箱功能的验证申请，请点击下面的连接完成验证。如非您本人操作，请勿略本邮件。<br> 您也可以复制以下地址，在浏览器地址栏中粘贴打开。<br> "+targetUrl);

		return true;
	}

	@Override
	@Deprecated
	public boolean sendIDInfo(String idcard, String realname) {
		if(logger.isInfoEnabled()) {
			logger.debug("ID号 " + idcard + "真实姓名：" + realname);
		}
		return true;
	}
	
}
